<?php
/**
 * Created by PhpStorm.
 * User: Tomkk
 * Date: 2016/5/5
 * Time: 18:44
 */

require 'utils/conn.php';

$postdata = file_get_contents("php://input");

$request = json_decode($postdata);
$user = $request->user;

$username = $user->username;
$password = $user->password;
$realname = $user->realName;
$cardnum = $user->idCardNum;
$business = $user->business;
$enteryear = $user->enteryear;
$classid = $user->classid;
$mobile = $user->mobile;
$address = $user->address;
$zipcode = $user->zipcode;
$headimg = $user->headimage;

//$sql = "INSERT INTO user VALUES ('".$username."','.$password.','.$realname.','.$cardnum.','.$business.','.$enteryear.','.$classid.','.$mobile.','.$address.','.$zipcode.')";
$sql = "INSERT INTO user (user_name, password, real_name, card_num, business, enter_year, class_id, mobile, address, zipcode, image, isuse)  VALUE (";
$sql .= "'".$username."',"."'".$password."',"."'".$realname."',"."'".$cardnum."',"."'".$business."',"."'".$enteryear."',"."'".$classid."',"."'".$mobile."',"."'".$address."',"."'".$zipcode."',"."'".$headimg."',"."'".true."'".");";
if(!mysqli_query($mysqli,$sql)){
    die(error(1,mysqli_error($mysqli)));
}else{
    die(success(0,null));
}



